function EmployeeGrid() {
}

EmployeeGrid.prototype.performRetrieve = function(configuration, otherstuff) {
		var appService = new EmployeeService();
		appService.retrievePaged(EmployeeGrid.prototype.fillGrid, configuration.page, configuration.rows, configuration.sord, configuration.sidx, "x => true");
};

EmployeeGrid.prototype.fillGrid = function(jsonData) {
		var thegrid = jQuery("#grid")[0];
		thegrid.addJSONData(jsonData);
};

EmployeeGrid.prototype.gridConfiguration = {
		datatype: EmployeeGrid.prototype.performRetrieve,
		colNames: ['TitleOfCourtesy','Title','ReportsTo','Region','PostalCode','PhotoPath','Notes','LastName','HomePhone','HireDate','FirstName','Extension','EmployeeId','Country','City','BirthDate','Address'],
		colModel: [
				{ name: 'TitleOfCourtesy', index: 'TitleOfCourtesy', width: 200, align: 'left' },
				{ name: 'Title', index: 'Title', width: 200, align: 'left' },
				{ name: 'ReportsTo', index: 'ReportsTo', width: 200, align: 'left' },
				{ name: 'Region', index: 'Region', width: 200, align: 'left' },
				{ name: 'PostalCode', index: 'PostalCode', width: 200, align: 'left' },
				{ name: 'PhotoPath', index: 'PhotoPath', width: 200, align: 'left' },
				{ name: 'Notes', index: 'Notes', width: 200, align: 'left' },
				{ name: 'LastName', index: 'LastName', width: 200, align: 'left' },
				{ name: 'HomePhone', index: 'HomePhone', width: 200, align: 'left' },
				{ name: 'HireDate', index: 'HireDate', width: 200, align: 'left' },
				{ name: 'FirstName', index: 'FirstName', width: 200, align: 'left' },
				{ name: 'Extension', index: 'Extension', width: 200, align: 'left' },
				{ name: 'EmployeeId', index: 'EmployeeId', width: 200, align: 'left' },
				{ name: 'Country', index: 'Country', width: 200, align: 'left' },
				{ name: 'City', index: 'City', width: 200, align: 'left' },
				{ name: 'BirthDate', index: 'BirthDate', width: 200, align: 'left' },
				{ name: 'Address', index: 'Address', width: 200, align: 'left' }
],
    caption: "EmployeeId",
    gridview: true,
    rownumbers: true,
    rownumWidth: 40,
    scroll: 1,
    rowNum: 100,
    sortname: 'CreatedDate',
    pager: '#pager',
    sortorder: "asc",
    viewrecords: true,
    autowidth: true,
    height: '100%',
    jsonReader: { root: "GridData", page: "CurrentPage", total: "TotalPages", records: "TotalRecords", repeatitems: false, id: "0" }
};

EmployeeGrid.prototype.SetupGrid = function(selector) {
    jQuery(selector).html('<table id="grid"></table><div id="pager"></div>');
    var grid = jQuery("#grid").jqGrid(this.gridConfiguration);
    grid.setGridHeight(outerLayout.panes.center.innerHeight() - 105);
};
